﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class book_edit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindGrid();
        }
    }
    private void BindGrid()
    {
        GridView1.DataSource = YF.BLL.BookBLL.list();
        GridView1.DataBind();
    }

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int bookid = Convert.ToInt32(this.GridView1.Rows[e.RowIndex].Cells[1].Text);
        if (YF.BLL.BookBLL.delete(bookid))
        {
            YF.JsHelper.Alert("删除成功");
            this.GridView1.DataSource = YF.BLL.BookBLL.list();
            this.GridView1.DataBind();
        }
        else
            YF.JsHelper.Alert("删除失败 ");
    }
}